home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1991-05-23 | 8.8 KB | 301 lines | [ TEXT/MPS ]
File #1: Mr. Disk:Articles:TPoseDialogCmd:Source, etc.:UTEDocument.inc1.p File #2: MacII:MPW:MacApp 2.0.1:Examples:DemoText:UTEDocument.inc1.p Extra lines in 1st before 6 in 2nd (File "Mr. Disk:Articles:TPoseDialogCmd:Source, etc.:UTEDocument.inc1.p"; Line 6:89; File "MacII:MPW:MacApp 2.0.1:Examples:DemoText:UTEDocument.inc1.p"; Line Δ6) USES { • Building Blocks } UDialog, { JLP: needed by UCharacterDialog } UGridView, { JLP: needed by UCharacterDialog } { • Required for this unit's interface } UMenuItemCommand, { JLP: needed by UCharacterDialog } UCharacterDialog, { • Implementation use } ToolUtils, Fonts, Resources, Script, Picker; {########################################################################### PRIVATE CLASSES ###########################################################################} TYPE {########################################################################### TTECharDialogCmd This class overrides CreateTheCommand() — its the only method that needs to know about the application data structures. ###########################################################################} TTECharDialogCmd = OBJECT(TCharacterDialogCmd) { ITECharDialogCmd(): Just passes its arguments to ICharacterDialogCmd. } PROCEDURE TTECharDialogCmd.ITECharDialogCmd( itsCmdNumber: CmdNumber; itsDocument: TDocument; itsView: TView; itsScroller: TScroller; itsTextStyle: TextStyle; itsAlignment: INTEGER); { CreateTheCommand(): Creates the command that is to be posted when the user accepts the dialog. } FUNCTION TTECharDialogCmd.CreateTheCommand : TCommand; OVERRIDE; {$IFC qInspector} PROCEDURE TTECharDialogCmd.Fields( PROCEDURE DoToField( fieldName: Str255; fieldAddr: Ptr; fieldType: INTEGER)); OVERRIDE; {$ENDC qInspector} END; { TTECharDialogCmd } {########################################################################### TTEStyleAndAlignCmd Changes the style and/or the alignment, as indicated by the given mode. (Alignment and justification are synonymous.) ###########################################################################} TTEStyleAndAlignCmd = OBJECT(TTEStyleCommand) fOldAlignment: INTEGER; fNewAlignment: INTEGER; PROCEDURE TTEStyleAndAlignCmd.ITEStyleAndAlignCmd( itsTEView: TTEView; itsTextStyle: TextStyle; itsCmdNumber: CmdNumber; itsMode: INTEGER; itsAlignment: INTEGER); PROCEDURE TTEStyleAndAlignCmd.DoIt; OVERRIDE; PROCEDURE TTEStyleAndAlignCmd.UndoIt; OVERRIDE; {$IFC qInspector} PROCEDURE TTEStyleAndAlignCmd.Fields( PROCEDURE DoToField( fieldName: Str255; fieldAddr: Ptr; fieldType: INTEGER)); OVERRIDE; {$ENDC qInspector} END; { TTEStyleAndAlignCmd } Nonmatching lines (File "Mr. Disk:Articles:TPoseDialogCmd:Source, etc.:UTEDocument.inc1.p"; Line 395:428; File "MacII:MPW:MacApp 2.0.1:Examples:DemoText:UTEDocument.inc1.p"; Line 311) {--------------------------------------------------------------------------------------------------} { DoCharacter(): Creates the command that poses the Character dialog (JLP). } PROCEDURE DoCharacter; VAR theCmd: TTECharDialogCmd; offset: INTEGER; theTextStyle: TextStyle; lineHeight: INTEGER; fontAscent: INTEGER; BEGIN TEGetStyle(fTEView.fHTE^^.selStart, theTextStyle, lineHeight, fontAscent, fTEView.fHTE); New(theCmd); FailNil(theCmd); theCmd.ITECharDialogCmd( cCharacter, { command number } SELF, { document } fTEView, { view } fTEView.GetScroller(TRUE), { scroller } theTextStyle, { TextStyle } fTEView.fJustification); { alignment } DoMenuCommand := theCmd; END; { DoCharacter } {--------------------------------------------------------------------------------------------------} BEGIN { DoMenuCommand } BEGIN { DoMenuCommand } Extra lines in 1st before 350 in 2nd (File "Mr. Disk:Articles:TPoseDialogCmd:Source, etc.:UTEDocument.inc1.p"; Line 467:469; File "MacII:MPW:MacApp 2.0.1:Examples:DemoText:UTEDocument.inc1.p"; Line Δ350) cCharacter: { JLP } DoCharacter; Extra lines in 1st before 542 in 2nd (File "Mr. Disk:Articles:TPoseDialogCmd:Source, etc.:UTEDocument.inc1.p"; Line 662:663; File "MacII:MPW:MacApp 2.0.1:Examples:DemoText:UTEDocument.inc1.p"; Line Δ542) Enable(cCharacter, TRUE); { JLP } Extra lines in 1st file (File "Mr. Disk:Articles:TPoseDialogCmd:Source, etc.:UTEDocument.inc1.p"; Line 888:1044; File "MacII:MPW:MacApp 2.0.1:Examples:DemoText:UTEDocument.inc1.p"; Line 765Δ) {############################################################################### TTECharDialogCmd ###############################################################################} {——————————————————————————————————————————————————————————————————————————————} {$S ASelCommand} PROCEDURE TTECharDialogCmd.ITECharDialogCmd( itsCmdNumber: CmdNumber; itsDocument: TDocument; itsView: TView; itsScroller: TScroller; itsTextStyle: TextStyle; itsAlignment: INTEGER); BEGIN ICharacterDialogCmd( itsCmdNumber, itsDocument, itsView, itsScroller, itsTextStyle, itsAlignment); END; { ITECharDialogCmd } {——————————————————————————————————————————————————————————————————————————————} {$S ADoCommand} { CreateTheCommand(): Creates the command that is to be posted when the user accepts the dialog. } FUNCTION TTECharDialogCmd.CreateTheCommand : TCommand; OVERRIDE; VAR oldTextStyle: TextStyle; newTextStyle: TextStyle; newAlign: INTEGER; aCmd: TTEStyleAndAlignCmd; BEGIN oldTextStyle := fTextStyle; { localize } { get the current TextEdit and alignment states from the Character Dialog } TCharDialogView(fTheDialog).GetDialogInfo(newTextStyle, newAlign); IF SameTextStyle(oldTextStyle, newTextStyle) & (fAlignment = newAlign) THEN CreateTheCommand := NIL { no change } ELSE IF (fAlignment = newAlign) THEN BEGIN CreateTheCommand := TTEView(fView).DoMakeStyleCommand( newTextStyle, cCharacter, doAllAndAlign); END ELSE { alignment changed; text style may have, too } BEGIN New(aCmd); FailNIL(aCmd); aCmd.ITEStyleAndAlignCmd(TTEView(fView), newTextStyle, fCmdNumber, doAllAndAlign, newAlign); CreateTheCommand := aCmd; END; { else } END; { CreateTheCommand } {——————————————————————————————————————————————————————————————————————————————} {$S AFields} {$IFC qInspector} PROCEDURE TTECharDialogCmd.Fields( PROCEDURE DoToField( fieldName: Str255; fieldAddr: Ptr; fieldType: INTEGER)); OVERRIDE; BEGIN DoToField('TTECharDialogCmd', NIL, bClass); INHERITED Fields(DoToField); END; { Fields } {$ENDC qDebug} {############################################################################### TTEStyleAndAlignCmd ###############################################################################} {——————————————————————————————————————————————————————————————————————————————} {$S ASelCommand} PROCEDURE TTEStyleAndAlignCmd.ITEStyleAndAlignCmd( itsTEView: TTEView; itsTextStyle: TextStyle; itsCmdNumber: CmdNumber; itsMode: INTEGER; itsAlignment: INTEGER); BEGIN ITEStyleCommand(itsTEView, itsTextStyle, itsCmdNumber, itsMode); fOldAlignment := itsTEView.fJustification; fNewAlignment := itsAlignment; END; { ITEStyleAndAlignCmd } {——————————————————————————————————————————————————————————————————————————————} {$S ADoCommand} PROCEDURE TTEStyleAndAlignCmd.DoIt; OVERRIDE; BEGIN INHERITED DoIt; IF (BAND(fMode, doAlign) <> 0) & (fNewAlignment <> fOldAlignment) THEN fTEView.SetJustification(fNewAlignment, kRedraw); END; { DoIt } {——————————————————————————————————————————————————————————————————————————————} {$S ADoCommand} PROCEDURE TTEStyleAndAlignCmd.UndoIt; BEGIN INHERITED UndoIt; IF (BAND(fMode, doAlign) <> 0) & (fNewAlignment <> fOldAlignment) THEN fTEView.SetJustification(fOldAlignment, kRedraw); END; { UndoIt } {——————————————————————————————————————————————————————————————————————————————} {$S AFields} {$IFC qInspector} PROCEDURE TTEStyleAndAlignCmd.Fields( PROCEDURE DoToField( fieldName: Str255; fieldAddr: Ptr; fieldType: INTEGER)); OVERRIDE; BEGIN DoToField('TTEStyleAndAlignCmd', NIL, bClass); DoToField('fOldAlignment', @fOldAlignment, bInteger); DoToField('fNewAlignment', @fNewAlignment, bInteger); INHERITED Fields(DoToField); END; { Fields } {$ENDC qDebug} {——————————————————————————————————————————————————————————————————————————————} *** EOF on both files ***